{% extends "@CoreBundle/layout/main.html.twig" %}

{% block page_title %}添加试题{% endblock %}
{% block breadcrumb %}
    <li class="breadcrumb-item"><a href="{{ path("qa_admin_node_index", {chapterId:chapterId, chapterSubId:chapterSubId}) }}">试题管理</a></li>
{% endblock %}

{% block page %}
<div class="card">
<form method="POST" action="{{ path("qa_admin_node_do_add") }}" class="form-horizontal ajaxform  needs-validation" accept-charset="UTF-8" novalidate>
  <div class="card-body" style="display: block;">
    {{ formData|raw }}
    <div class="form-group  row " id="chooseBlock">
      <label for="title" class="col-sm-2 require col-form-label" >选择项:</label>
      <div class="col-sm-8">
        <div class="input-group">
          A、<input type="text" style="margin-bottom: 10px;" name="choose[]" class="form-control form-control-sm" value="" />
        </div>
        <div class="input-group">
          B、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="" />
        </div>
        <div class="input-group">
          C、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="" />
        </div>
        <div class="input-group">
          D、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="" />
        </div>
        <div class="input-group">
          E、<input type="text" style="margin-bottom: 10px;"  name="choose[]" class="form-control form-control-sm" value="" />
        </div>
      </div>
    </div>
    <div class="form-group  row">
      <label for="title" class="col-sm-2 require col-form-label" >答案:</label>
      <div class="col-sm-8">
        <div class="input-group">
          <input type="text" name="answer" class="form-control form-control-sm"
          data-required="1" value="" placeholder="多个答案使用'|'隔开,答案中有'|'使用'\|'替代;在答案后加':'加答案分数" />
        </div>
      </div>
    </div>
  </div>
  <div class="card-footer">
    <div class="col-md-2"></div>
    <div class="col-md-8">
      <div class="btn-group">
        <button type="submit" class="btn btn-sm btn-info " style="margin-right: 10px;">提交</button>
        <button type="reset" class="btn btn-default btn-sm reset"><i class="fa fa-undo"></i>&nbsp;&nbsp;重置</button>
      </div>
    </div>
  </div>
</form>
</div>
{% endblock %}

{% block body_custom_javascript %}
    <script>
       $("#type").change(function(){
          var vl = $(this).val();
          if(vl <3){
            $("#chooseBlock").show();
          }else{
            $("#chooseBlock").hide();
          }
       });

       var vl = $("#type").val();
       if(vl <3){
         $("#chooseBlock").show();
       }else{
         $("#chooseBlock").hide();
       }
    </script>
{% endblock %}
